package com.myprojects.common.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.Date;

public class Employee {
    private Integer id;

    @NotBlank(message = "姓名不能为空!")
    @Pattern(regexp = "^([a-zA-Z0-9\\u4e00-\\u9fa5\\·]{1,10})$",
            message = "姓名格式错误!")
    private String employee_name;

    @NotBlank(message = "身份证不能为空!")
    @Pattern(regexp = "(^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{2}$)",
            message = "身份证格式错误!")
    private String id_card;

    @NotNull(message = "生日不能为空!")
    @DateTimeFormat(pattern = "yyyy-MM-dd") //设置输入的时间格式
    @JsonFormat(pattern="yyyy-MM-dd", timezone = "GMT+8")//设置输出的时间格式
    private Date birthday;

    @NotNull(message = "性别不能为空!")
    private Byte gender;

    private Integer position_id;

    private Byte status;

    private Integer resume_id;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getEmployee_name() {
        return employee_name;
    }

    public void setEmployee_name(String employee_name) {
        this.employee_name = employee_name == null ? null : employee_name.trim();
    }

    public String getId_card() {
        return id_card;
    }

    public void setId_card(String id_card) {
        this.id_card = id_card == null ? null : id_card.trim();
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public Byte getGender() {
        return gender;
    }

    public void setGender(Byte gender) {
        this.gender = gender;
    }

    public Integer getPosition_id() {
        return position_id;
    }

    public void setPosition_id(Integer position_id) {
        this.position_id = position_id;
    }

    public Byte getStatus() {
        return status;
    }

    public void setStatus(Byte status) {
        this.status = status;
    }

    public Integer getResume_id() {
        return resume_id;
    }

    public void setResume_id(Integer resume_id) {
        this.resume_id = resume_id;
    }

    @Override
    public String toString() {
        return "Employee{" +
                "id=" + id +
                ", employee_name='" + employee_name + '\'' +
                ", id_card='" + id_card + '\'' +
                ", birthday=" + birthday +
                ", gender=" + gender +
                ", position_id=" + position_id +
                ", status=" + status +
                ", resume_id=" + resume_id +
                "}\n";
    }
}